from django.shortcuts import render,HttpResponse,redirect


# Create your views here.
from django.http import HttpResponse
from .models import Grades,Students
from django.shortcuts import render,HttpResponse,redirect
def index(request):
    return HttpResponse('20级大数据一班')

def showgrade(request):
    grades = Grades.objects.all()
    return render(request,'grade.html',{'params':grades})

def addgrade(request):
    newgrade = Grades.createGrade('002')
    newgrade.save()
    return redirect('/yyds/showgrade/')

def deletegrade(request, param=None):
    Grades.objects.filter(id=param).update(gname='test班级')
    return HttpResponse('/yyds/showgrade/')

def updategrade(request,param):
    Grades.objects.filter(id=param).update(gname='test班级')
    return redirect('/yyds/showgrade/')


